feat(sqlite): benchmark cold reads#4848
Conversation
Preview packages published to npmInstall with: npm install rivetkit@pr-4848All packages published as Engine binary is shipped via Docker images: docker pull rivetdev/engine:slim-30c00ff
docker pull rivetdev/engine:full-30c00ffIndividual packagesnpm install rivetkit@pr-4848
npm install @rivetkit/react@pr-4848
npm install @rivetkit/rivetkit-napi@pr-4848
npm install @rivetkit/workflow-engine@pr-4848 |
638ed55 to
d05d4d4
Compare
298ede2 to
dc8f1c2
Compare
Code Review — PR #4848: feat(sqlite): benchmark cold readsThis is a draft PR adding SQLite cold-read benchmarking infrastructure alongside several VFS performance improvements. The scope is large (~5.5k additions) but most additions are raw benchmark output artifacts in OverviewThe PR delivers multiple things at once:
Benchmark summary: cold wake-read went from 1,249 Bugs / CorrectnessIndentation error in After Self {
cache_capacity_pages: DEFAULT_CACHE_CAPACITY_PAGES,
prefetch_depth: if flags.read_ahead { ... },
adaptive_prefetch_depth: DEFAULT_ADAPTIVE_PREFETCH_DEPTH, // ← extra tab
max_prefetch_bytes: DEFAULT_MAX_PREFETCH_BYTES,
...
}This will likely not compile, or the closing brace of TypeScript indentation regressions
- const db = await nativeDatabaseProvider.open(ctx.actorId);
+ const db = await nativeDatabaseProvider.open(ctx.actorId);and similarly
fn new(start_pgno: u32, end_pgno: u32) -> Self {
Self {
start_pgno,
page_count: end_pgno.saturating_sub(start_pgno).saturating_add(1),
}
}When Design Concerns
sqlite_vfs_commit_duration_seconds_total.with_label_values(&["total"]);
// ...
inner.sqlite_vfs_commit_duration_seconds_total
.with_label_values(&["total"])
.inc_by(ns_to_seconds(total_ns));The only label value is
let depth = if self.score >= FORWARD_SCAN_SCORE_THRESHOLD + 4 {
config.adaptive_prefetch_depth
} else {
config.adaptive_prefetch_depth.min(config.prefetch_depth.saturating_mul(2))
};
let mut retained = VecDeque::new();
while let Some(existing) = ranges.pop_front() { ... }
*ranges = retained;This always allocates a new Performance
Removed APIs
The Minor / Style
SummaryThe core algorithmic work (adaptive read-ahead, recent-page tracker, Prometheus metrics wiring) is solid and the benchmark results show meaningful improvement. The main blockers before merge are:
|
Code Review: PR #4848 — feat(sqlite): benchmark cold readsOverviewThis PR establishes SQLite cold-read optimization infrastructure for RivetKit actors: adaptive read-ahead with forward-scan detection, a recent-page hint tracker for preload suggestions, a new IssuesIndentation regression —
|
d05d4d4 to
b712711
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: